<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
    <title>Carbon Datasources - User Guide</title></head>
<body>

<h1>Carbon Datasources</h1>
<h2>Content</h2><div class="toc"><ul><li><a href="#Introducti">Introduction</a></li>
    <li><a href="#createDS">Create Carbon Datasource</a></li>
    <li><a href="#exposeJndi">Expose as a JNDI Datasource</a></li>
    <li><a href="#dsConfigParams">Defining Datasource Configuration Parameters</a></li>
    </ul>
</div><h2 id="Introducti">Introduction</h2>
	<p>Carbon Datasource feature in Data Services Server can be used to create datasources which can be used inside data services
	directly through the name of the Carbon Datasource. The datasources created using Carbon Datasource feature will be persisted, 
	and can be used when ever required.</p>

	<h2 id="createDS">Create Carbon DataSource</h2>
	
	<p>To create the carbon datasource click on the Datasources menu item under the
            configuration.
        </p>

        <br/>
        <img alt="DS" src="images/create_datasource.png"/>
        <p>Figure 1: Create Carbon Datasource menu</p>
        <br/>

        <p>Click on 'Add Datasource' link in Datasources page which will direct you to a page
            where you
            can enter the details for the datasource. 
        </p>

	<p>
	You can select a datasource provider from the highlighted combo box. For the 'default' Data 
	Source Provider, given connection properties Driver, URL, User Name and 
	Password need to be entered.
	</p>

        <br/>
        <img alt="DS" src="images/carbon_datasource_default.png"/>
        <p>Figure 2: Creating the Carbon Datasource</p>
        <br/>

	<p>
	If you need to add a datasource supported by an External Datasource Provider class such 
	as com.mysql.jdbc.jdbc2.optional.MysqlXADataSource, select 'external' as the Data 
	Source Provider. Then enter the name and value of connection properties by 
	clicking 'Add Property'. Given below is an example datasource  of External 
	Datasource Provider
	with eneterd values. 
	</p>

	<br/>
	<img alt="DS" src="images/carbon_datasource_external.png"/>
        <p>Figure 3: Creating the Carbon Datasource of External Datasource Provider</p>
        

	<p>
	After entering the details you can test the connection by click on 'Test Connection' 
	button on bottom of the page. Then click 'Add' to save the datasource. 
	</p>

	<br/>

        <p>Once you have created the carbon datasource, you can use it inside the data service.
            Select the 'Carbon Datasource' as the type of the datasource in Add datasource page
            in the
            data services wizard. Select the carbon datasource name which you have created from the
            drop down list.
        </p>

        <br/>
        <img alt="DS" src="images/add_carbon_ds.png"/>
        <p>Figure 4: Creating the datasource for Carbon Datasource</p>
        <br/>
      
      
      <h2 id="exposeJndi">Expose as a JNDI Datasource</h2>
        <p>The adding datasource can be exposed as a JNDI Datasource as well. Expand
	'Expose as a JNDI datasource' and enter the required values. If the 
	datasource will be using Datasource Factory, click on the checkbox 
	'Use Datasource Factory' and define the JNDI properties. Given below is an 
	example JNDI configuration. 
        </p>
        <br/>
        <img alt="DS" src="images/carbon_datasource_jndi.png"/>
        <p>Figure 5: Expose as a JNDI Datasource</p>
        <br/>
        <p>When creating the data service select the datasource type as 'JNDI' and enter the values
            to be used to connect to the previously created JNDI enabled datasource.
        </p>
        <br/>
        <img alt="DS" src="images/jndi_dataservice.png"/>
        <p>Figure 6: Creating the datasource for JNDI</p>
        <br/>
        
		<h2 id="dsConfigParams">Defining Datasource Configuration Parameters</h2>
	<p>
	By expanding the 'Datasource Configuration Parameters' you can set the jdbc-pool 
	properties for the datasource.
	</p>
	<br/>
        <img alt="DS" src="images/ds_expand_config_params.png"/>
        <p>Figure 7: Expanding Datasource Configuration Parameters</p>
        <br/>

	<p>
	Datasource Configuration Parameters with default values is showing below. 
	</p>
	<br/>
        <img alt="DS" src="images/ds_config_params.png"/>
        <p>Figure 8: Datasource Configuration Parameters</p>
        <br/>
		
<div class="clear">
</div>
<div id="footer">
    <div class="xright">&#169;
        2011
        WSO2 Inc

    </div>
    <div class="clear">
        <hr/>
    </div>
</div>
</body>
</html>